;;;;;;;;;;;;;;;;;;;;  gnuplot setting  ;;;;;;;;;;;;;;;;;;;;
(setq load-path (append (list "/scratch/emacs/share/emacs/gnuplot") load-path))
(autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t)
(autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot mode" t)
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))

;;;;;;;;;;;;;;;;;;;;  matlab setting  ;;;;;;;;;;;;;;;;;;;;
(autoload 'matlab-eei-connect "matlab-eei" 
  "Connects Emacs to MATLAB's external editor interface.")
(autoload 'matlab-mode "matlab" "Enter MATLAB mode." t)
(setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist))
(autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t)
(setq matlab-indent-function-body t) ; if you want function bodies indented
(setq matlab-verify-on-save-flag nil) ; turn off auto-verify on save
(setq matlab-shell-command-switches '("-nodesktop"))
(setq-default matlab-show-mlint-warnings t)
(setq-default matlab-functions-have-end t)
(setq-default highlight-cross-function-variables t)
(autoload 'mlint-minor-mode "mlint" nil t)
(autoload 'tlc-mode "tlc" "tlc Editing Mode" t)
(add-to-list 'auto-mode-alist '("\\.tlc$" . tlc-mode))
(setq tlc-indent-function t)
(setq max-specpdl-size 6800)
(setq matlab-shell-enable-gud-flag t)
(setq matlab-highlight-cross-function-variables t)
(setq matlab-return-add-semicolon t)
(setq matlab-shell-ask-MATLAB-for-completions t)
(setq matlab-shell-enable-gud-flag t)
(setq matlab-show-periodic-code-details-flag t)
(defvar my-extra-keywords
  '(("\(\<[0-9.]+\>\)" . 'font-lock-number-face)))
(font-lock-add-keywords 'matlab-mode my-extra-keywords)

;;;;;;;;;;;;;;;;;;;;  mathematica setting  ;;;;;;;;;;;;;;;;;;;;
(require 'mathematica)
(autoload 'octave-help "octave-help" nil t)
(setq mathematica-command-line "/scratch/progs/mathematica7/Executables/math")

;;;;;;;;;;;;;;;;;;;;  maple setting  ;;;;;;;;;;;;;;;;;;;;
(autoload 'maplev-mode "maplev" "Maple editing mode" t)
(autoload 'cmaple      "maplev" "Start maple process" t)
(setq auto-mode-alist (cons `("\\.mpl\\'" . maplev-mode) auto-mode-alist))
(setq maplev-default-release "13")

;;;;;;;;;;;;;;;;;;;;  octave setting  ;;;;;;;;;;;;;;;;;;;;
(autoload 'octave-mode "octave-mod" nil t)
(setq octave-help-files '("octave" "octave-LG"))

;;;;;;;;;;;;;;;;;;;;  imaxima setting  ;;;;;;;;;;;;;;;;;;;;
(autoload 'imaxima "imaxima" "Frontend for maxima with Image support" t)
(autoload 'maxima "maxima" "Frontend for maxima" t)
(autoload 'imath-mode "imath" "Imath mode for math formula input" t)
(setq imaxima-fnt-size "Large")
(setq imaxima-print-tex-command "latex %s; dvipdf %s.dvi imax.pdf; open imax.pdf")
(setq imaxima-equation-color "magenta")

;;;;;;;;;;;;;;;;;;;;  hook  ;;;;;;;;;;;;;;;;;;;;
(add-hook 'mathematica-mode-hook 'my-c-mode-auto-pair)
(add-hook 'maplev-mode-hook 'my-c-mode-auto-pair)
(add-hook 'imath-mode-hook 'my-c-mode-auto-pair)
(add-hook 'imaxima-mode-hook 'my-c-mode-auto-pair)
(add-hook 'octave-mode-hook
          (lambda ()
            (abbrev-mode 1)
            (auto-fill-mode 1)
            (if (eq window-system 'x)
                (font-lock-mode 1))))
(setq matlab-shell-history-file emax-matlabhistory)
(add-hook 'matlab-mode-hook 'my-c-mode-auto-pair)
;;(add-hook 'matlab-mode-hook (lambda () (mlint-minor-mode 1)))
(defun my-matlab-mode-hook ()
  (setq fill-column 200))       ; where auto-fill should wrap
(add-hook 'matlab-mode-hook 'my-matlab-mode-hook)
(defun my-matlab-shell-mode-hook ()
  '())
(add-hook 'matlab-shell-mode-hook 'my-matlab-shell-mode-hook)

;;;;;;;;;;;;;;;;;;;;  junk  ;;;;;;;;;;;;;;;;;;;;
;; number font face
;; (defface font-lock-number-face
;;   '((t (:foreground "lime green")))
;;   "Used for numbers and such.")
;;(global-font-lock-mode t)
;;(matlab-mode-hilit)
;; (require 'semantic-matlab)
;; add it to matlab-mode
;;; (autoload 'mathematica-m-mode "mathematica.el" "Mathematica package file mode" t)
;;; (setq auto-mode-alist (cons '("\\.m\\'" . mathematica-m-mode) auto-mode-alist))
;;(setq imaxima-bg-color "white")
;;(setq imaxima-use-maxima-mode-flag t)

